﻿@{
    ViewBag.Title = "MiniCart";
    Layout = null;
}

@if (ViewBag.cart == null)
{                   
    <div class="non-product">
        Chưa có sản phẩm nào trong giỏ hàng của bạn!
    </div>
}
else
{             
    <div class="cartQty">
        Có <a href='javascript:;' onclick="javascript:loadAction('cart','Account')">
            <span id="pInCart">@Enumerable.Count(ViewBag.cart)</span> sản phẩm</a> trong giỏ. 
    </div>    
    <hr />
    int total = 0;
    foreach(var pro in ViewBag.proList)
    {
    <div class="product">
        <div class="product-image">
            <a href="javascript:;" onclick="javascript:viewProduct(@pro.ID)">
                <img src="/Content/data/images/350.300/@pro.image_link" alt="" height="50"></a>
        </div>
        <div class="product-detail">
            <a class="widget-btn" href="javascript:;" title="Xóa sản phẩm khỏi giỏ hàng" onclick="javascript:RemoveProductFromCart(@pro.ID)">
                <img src="/Content/data/icon/list_remove_btn.gif" alt=""></a>
            <div>
                 <a href="javascript:;" onclick="javascript:viewProduct(@pro.ID)">@pro.name</a>
            </div>
            <div><strong>@ViewBag.cart[pro.ID]</strong> x 
                @{int price = @Convert.ToInt32(pro.price);}
                @if (pro.promotion_ID > 0)
                {
                    price = Convert.ToInt32(pro.price / 100 * (100 - pro.Promotion.rate));
                }
                <span class="price">@price VND</span>                
                @{total += price * ViewBag.cart[pro.ID];}
            </div>
        </div>
    </div>
    }
    <br />
    <div>Tổng tiền: <b>@total VND</b></div>
    <div  class="action">
        <a href='javascript:;' onclick="javascript:loadAction('Checkout','Account')">Đặt hàng &amp; Thanh toán</a>
    </div>
}

